package vip.xiaozhao.paotui.intf.enums;


public enum PaotuiNumberEnum {

    All(0, "所有"),
    One(1, "1个"),
    Two(2, "2个"),
    MoreThanTwo(3, "2个以上");

    private int id;
    private String name;


    PaotuiNumberEnum(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public static PaotuiNumberEnum getById(int id) {
        for (PaotuiNumberEnum type : PaotuiNumberEnum.values()) {
            if (type.getId() == id)
                return type;
        }
        return null;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    /**
     * Getter method for property <tt>name</tt>.
     *
     * @return property value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Setter method for property <tt>name</tt>.
     *
     * @param name value to be assigned to property name
     */
    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        System.out.println(getById(1).getName());
    }

}
